/**
 * 
 */
package com.chanyachting.emall.serviceImpl;

import java.util.List;

import com.chanyachting.emall.dao.YellowpagecategoryDAO;
import com.chanyachting.emall.dao.YellowpagekeywordDAO;
import com.chanyachting.emall.dao.YellowpagesubcategoryDAO;
import com.chanyachting.emall.domain.Yellowpagecategory;
import com.chanyachting.emall.domain.Yellowpagekeyword;
import com.chanyachting.emall.domain.Yellowpagesubcategory;
import com.chanyachting.emall.service.YellowPageService;

/**
 * @author robert
 *
 */
public class YellowPageServiceImpl implements YellowPageService {

	private YellowpagecategoryDAO ypcgDao;
	private YellowpagekeywordDAO ypkwDao;
	private YellowpagesubcategoryDAO ypscgDao;
	
	public YellowPageServiceImpl() {
		this.ypcgDao = new YellowpagecategoryDAO();
		this.ypkwDao = new YellowpagekeywordDAO();
		this.ypscgDao = new YellowpagesubcategoryDAO();
	}
	
	@SuppressWarnings("unchecked")
	public List<Yellowpagecategory> getAllYellowpagecategory() {
		String sql = "from Yellowpagecategory where 1=1 order by pri";
		return this.ypcgDao.find(sql);
	}

	@SuppressWarnings("unchecked")
	public List<Yellowpagekeyword> getAllYellowpagekeyword() {
		String sql = "from Yellowpagekeyword where 1=1";
		return this.ypkwDao.find(sql);
	}

	@SuppressWarnings("unchecked")
	public List<Yellowpagesubcategory> getYellowpagesubcategory(String categoryId) {
		String sql = "from Yellowpagesubcategory where categoryId=? order by pri";
		return this.ypscgDao.find(sql,new String[]{categoryId});
	}

}
